import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Event And Notification Widget Demo"),
      ),
      body: const GestureWidget(),
    ),
  ));
}

class GestureWidget extends StatefulWidget {
  const GestureWidget({Key? key}) : super(key: key);


  @override
  _GestureWidgetState createState() => _GestureWidgetState();

  }

class _GestureWidgetState extends State<GestureWidget> {

  String _operation = "No Gesture detected!";

  @override
  Widget build(BuildContext context) {
    return Center(
      child: GestureDetector(
        child: Container(
          alignment: Alignment.center,
          color: Colors.blue,
          width: 200.0,
          height: 100.0,
          child: Text(_operation, style: const TextStyle(color: Colors.white),),
        ),
        onTap: () => updateText("Tap"),
        onDoubleTap: () => updateText("DoubleTap"),
        onLongPress: () => updateText("LongPress"),
      ),
    );
  }

  void updateText(String text) {
    setState(() => _operation = text);
  }
}
